package com.by.common.dao.bean;

/**
 * @author ServivE
 * @version 0.1
 * @className Page
 * @description
 * @date 2024/11/6 20:43
 * @since jdk17
 */

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

/**
 * 分页查询条件基础类
 */
@ApiModel("分页bean")
public class Page {

    private final int DEFAULT_PAGE = 1;//默认第一页
    private final int DEFAULT_PAGESIZE = 10;//默认一页显示10条记录

    @ApiModelProperty(value = "当前第几页 默认1")
    int page;
    @ApiModelProperty(value = "每页记录数 默认10")
    int pageSize;

    public int getPage() {
        if (this.page == 0) {
            return DEFAULT_PAGE;
        }
        return page;
    }

    public void setPage(int page) {
        if (page <= 0) {
            this.page = DEFAULT_PAGE;
        }else
        this.page = page;
    }

    public int getPageSize() {
        if (this.pageSize == 0) {
            return DEFAULT_PAGESIZE;
        }
        return pageSize;
    }

    public void setPageSize(int pageSize) {
        this.pageSize = pageSize;
    }
}
